﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace kpi
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.Name.Equals(""))
            {
                Label_Msg.Text = "<br />";
                Label_Msg.Text += "您还没有登录，请您<a href=\"Account/Login.aspx\">登录</a>，如果您还没有账户，请您<a href=\"Account/Register.aspx\">注册</a>。";

                Label_Msg.Visible = true;
            }
            else
            {
                Label_Msg.Visible = false;
            }

            //if ((!User.IsInRole("User")) & (!User.IsInRole("Financial")) & (!User.IsInRole("u_manager")))
            //{
            //    Label_UserGuide.Text = "<br />";
            //    Label_UserGuide.Text += "<fieldset>";
            //    Label_UserGuide.Text += "<legend>说明</legend>";                
            //    Label_UserGuide.Text += "<ol>";
            //    Label_UserGuide.Text += "<li>新用户首次使用该系统，首先应当注册用户账户；已经注册账户的用户，请进行登录。</li>";
            //    Label_UserGuide.Text += "<li>系统中的账户只分为“管理者账户”和“一般账户”两种，区别是“管理者账户”可以对所管理的“一般账户”进行查看和评分。</li>";
            //    Label_UserGuide.Text += "<li>所有账户注册完成即为“一般账户”，“管理者账户”需要系统管理员进行<a href=\"Account/UserRolesMgr.aspx\">人工指定</a>。</li>";
            //    Label_UserGuide.Text += "</ol>";
            //    Label_UserGuide.Text += "</fieldset>";
            //    Label_UserGuide.Visible = true;
            //}
            if (User.IsInRole("master"))
            {
                Label_NavigationLink.Text = "<br />";
                Label_NavigationLink.Text += "<ul>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiForm.aspx\">管理下级KPI信息</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiFormUserMgr.aspx\">管理我的下级用户</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/FinKpiFileMgr.aspx?ua=m\">管理财务预算文件</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/SalKpiFileMgr.aspx?ua=m\">管理销售预算文件</a></li>";
                Label_NavigationLink.Text += "</ul>";
                Label_NavigationLink.Visible = true;
            }
            else if (User.IsInRole("User"))
            {
                Label_NavigationLink.Text = "<br />";
                Label_NavigationLink.Text += "<ul>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
                //取消KPI自评分
                //Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">对我的KPI信息进行自评分</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/KpiFileMgr.aspx?ua=d\">下载预算指标文件</a></li>";
                Label_NavigationLink.Text += "</ul>";
                Label_NavigationLink.Visible = true;

                Label_UserGuide.Text = "<br />";
                Label_UserGuide.Text += "<fieldset>";
                Label_UserGuide.Text += "<legend>说明</legend>";
                Label_UserGuide.Text += "<ol>";
                Label_UserGuide.Text += "<li>您已作为“一般账户”登录。</li>";
                Label_UserGuide.Text += "<li>您可以录入自己的KPI信息，录入和修改KPI完成情况，查看自己的KPI得分。</li>";
                Label_UserGuide.Text += "<li>您不能查看或管理下级用户。</li>";
                Label_UserGuide.Text += "<li>您不能查看或管理其他用户的KPI信息。</li>";
                Label_UserGuide.Text += "</ol>";
                Label_UserGuide.Text += "</fieldset>";
                Label_UserGuide.Visible = true;
            }
            else if (User.IsInRole("u_manager"))
            {
                if (User.IsInRole("Financial"))
                {
                    Label_NavigationLink.Text = "<br />";
                    Label_NavigationLink.Text += "<ul>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiForm.aspx\">管理下级KPI信息</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiFormUserMgr.aspx\">管理我的下级用户</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/FinKpiFileMgr.aspx?ua=m\">管理财务预算文件</a></li>";
                    Label_NavigationLink.Text += "</ul>";
                    Label_NavigationLink.Visible = true;

                    Label_UserGuide.Text = "<br />";
                    Label_UserGuide.Text += "<fieldset>";
                    Label_UserGuide.Text += "<legend>说明</legend>";
                    Label_UserGuide.Text += "<ol>";
                    Label_UserGuide.Text += "<li>您已作为“财务账户”登录。</li>";
                    //Label_UserGuide.Text += "<li>您可以录入自己的KPI信息，对KPI信息进行自评分，查看自己和所属下级的KPI信息。</li>";
                    //Label_UserGuide.Text += "<li>您还可以添加下级用户，并对其KPI信息进行考评。</li>";
                    Label_UserGuide.Text += "</ol>";
                    Label_UserGuide.Text += "</fieldset>";
                    Label_UserGuide.Visible = true;
                }
                else if (User.IsInRole("salesManager"))
                {
                    Label_NavigationLink.Text = "<br />";
                    Label_NavigationLink.Text += "<ul>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiFormUserMgr.aspx\">管理我的下级用户</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiForm.aspx\">管理下级KPI信息</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/SalKpiFileMgr.aspx?ua=m\">管理销售预算文件</a></li>";
                    Label_NavigationLink.Text += "</ul>";
                    Label_NavigationLink.Visible = true;

                    Label_UserGuide.Text = "<br />";
                    Label_UserGuide.Text += "<fieldset>";
                    Label_UserGuide.Text += "<legend>说明</legend>";
                    Label_UserGuide.Text += "<ol>";
                    Label_UserGuide.Text += "<li>您已作为“财务账户”登录。</li>";
                    //Label_UserGuide.Text += "<li>您可以录入自己的KPI信息，对KPI信息进行自评分，查看自己和所属下级的KPI信息。</li>";
                    //Label_UserGuide.Text += "<li>您还可以添加下级用户，并对其KPI信息进行考评。</li>";
                    Label_UserGuide.Text += "</ol>";
                    Label_UserGuide.Text += "</fieldset>";
                    Label_UserGuide.Visible = true;
                }
                else
                {
                    Label_NavigationLink.Text = "<br />";
                    Label_NavigationLink.Text += "<ul>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                    //取消KPI自评分
                    //Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">对我的KPI信息进行自评分</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiFormUserMgr.aspx\">管理我的下级用户</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiForm_uManager/KpiForm.aspx\">管理下级KPI信息</a></li>";
                    Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/KpiFileMgr.aspx?ua=d\">下载预算指标文件</a></li>";
                    Label_NavigationLink.Text += "</ul>";
                    Label_NavigationLink.Visible = true;

                    Label_UserGuide.Text = "<br />";
                    Label_UserGuide.Text += "<fieldset>";
                    Label_UserGuide.Text += "<legend>说明</legend>";
                    Label_UserGuide.Text += "<ol>";
                    Label_UserGuide.Text += "<li>您已作为“管理者账户”登录。</li>";
                    Label_UserGuide.Text += "<li>您可以录入自己的KPI信息，对KPI信息进行自评分，查看自己和所属下级的KPI信息。</li>";
                    Label_UserGuide.Text += "<li>您还可以添加下级用户，并对其KPI信息进行考评。</li>";
                    Label_UserGuide.Text += "</ol>";
                    Label_UserGuide.Text += "</fieldset>";
                    Label_UserGuide.Visible = true;
                }
            }
            else if (User.IsInRole("Financial"))
            {
                Label_NavigationLink.Text = "<br />";
                Label_NavigationLink.Text += "<ul>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";                
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/FinKpiFileMgr.aspx?ua=m\">管理财务预算文件</a></li>";
                Label_NavigationLink.Text += "</ul>";
                Label_NavigationLink.Visible = true;

                Label_UserGuide.Text = "<br />";
                Label_UserGuide.Text += "<fieldset>";
                Label_UserGuide.Text += "<legend>说明</legend>";
                Label_UserGuide.Text += "<ol>";
                Label_UserGuide.Text += "<li>您已作为“财务账户”登录。</li>";
                //Label_UserGuide.Text += "<li>您可以录入自己的KPI信息，对KPI信息进行自评分，查看自己和所属下级的KPI信息。</li>";
                //Label_UserGuide.Text += "<li>您还可以添加下级用户，并对其KPI信息进行考评。</li>";
                Label_UserGuide.Text += "</ol>";
                Label_UserGuide.Text += "</fieldset>";
                Label_UserGuide.Visible = true;
            }
            else if (User.IsInRole("salesManager"))
            {
                Label_NavigationLink.Text = "<br />";
                Label_NavigationLink.Text += "<ul>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
                Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/SalKpiFileMgr.aspx?ua=m\">管理销售预算文件</a></li>";
                Label_NavigationLink.Text += "</ul>";
                Label_NavigationLink.Visible = true;

                Label_UserGuide.Text = "<br />";
                Label_UserGuide.Text += "<fieldset>";
                Label_UserGuide.Text += "<legend>说明</legend>";
                Label_UserGuide.Text += "<ol>";
                Label_UserGuide.Text += "<li>您已作为“财务账户”登录。</li>";
                //Label_UserGuide.Text += "<li>您可以录入自己的KPI信息，对KPI信息进行自评分，查看自己和所属下级的KPI信息。</li>";
                //Label_UserGuide.Text += "<li>您还可以添加下级用户，并对其KPI信息进行考评。</li>";
                Label_UserGuide.Text += "</ol>";
                Label_UserGuide.Text += "</fieldset>";
                Label_UserGuide.Visible = true;
            }
            //else if (User.IsInRole("master"))
            //{
            //    Label_NavigationLink.Text = "<br />";
            //    Label_NavigationLink.Text += "<ul>";
            //    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiForm.aspx\">录入并确认我的KPI信息</a></li>";
            //    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/KpiFormUserRec.aspx\">我的KPI完成情况</a></li>";
            //    Label_NavigationLink.Text += "<li><a href=\"KpiForm_user/ShowKpiInfo.aspx\">查看我的KPI考评得分</a></li>";
            //    Label_NavigationLink.Text += "<li><a href=\"KpiFileManager/KpiFileMgr.aspx?ua=m\">管理财务预算文件</a></li>";
            //    Label_NavigationLink.Text += "</ul>";
            //    Label_NavigationLink.Visible = true;
            //}
        }
    }
}
